﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BI.CF.Model;
using BI.CF.BLL;

namespace BackStage
{
    public partial class PublishTypeShow : System.Web.UI.Page
    {
        BulletinBLL bll = new BulletinBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TypeShow();
            }
        }
        public void TypeShow()
        {
            
            Repeater1.DataSource = bll.PublishTypeShow();
            Repeater1.DataBind();
        }
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);
            string name = e.CommandName;
            if (name=="del")
            {
                if (bll.PublishTypeDelete(id)==true)
                {
                    Response.Write("删除成功");
                    TypeShow();
                }
                
            }
            if (name == "upd")
            {
                Response.Redirect("UpdatePublishType.aspx?id=" + id);
            }
        }
    }
}